<?php
namespace classlib;
require 'plugins/class.JavaScriptPacker.php';
class packer {
	/**
	 * 压缩js资料信息文件
	 * Enter description here ...
	 * @param string $script
	 * @return string $res
	 */
	public static function packjs($script) {
		$script = file_get_contents($script);
		$packer = new \JavaScriptPacker($script, 'Normal', true, false);
		$packed = $packer->pack();
		return $packed;
	}
	
	/**
	 * css文件压缩处理
	 * Enter description here ...
	 * @param string $script
	 * @return string $res
	 */
	public static function packcss($script) {
		$packed = '';
		$packed = @file_get_contents($script);
	    $packed = preg_replace("/[\r\n]/", '', $packed);
	    return $packed;
	}
}
